# 2.读写word
from docx import Document
from docx.shared import Pt

# 打开word文档
document = Document()
# 添加标题
document.add_heading(u'一级标题', 1)
# 添加文本
paragraph = document.add_paragraph(u'我是正文 ')
# 设置字号
run = paragraph.add_run(u'设置字号 ')
run.font.size = Pt(24)
# 设置字体
run = paragraph.add_run('Set Font')
run.font.name = 'Consolas'
# 保存文件
document.save(u'day01.docx')
print('word写入成功!')
# 读取word文档
# 打开word
document = Document(u'day01.docx')
# 读取每段资料
text_list = [paragraph.text for paragraph in document.paragraphs];
for i in text_list:
    print(i)